import request from '@/api/request'

// 用户注册
export function registerUser(data) {
    return request({
        url: '/auth/users/',
        method: 'post',
        data
    })
}


// 激活用户
export function activateUser(data) {
    return request({
        url: '/auth/users/activation/',
        method: 'post',
        data
    })
}

// 用户登录
export function loginUser(data) {
    return request({
        url: '/auth/jwt/create/',
        method: 'post',
        data
    })
}

// 刷新 access_token
export function refreshAccessToken(data) {
    return request({
        url: '/auth/jwt/refresh/',
        method: 'post',
        data
    })
}

// 重置密码
export function resetPassword(data) {
    return request({
        url: '/auth/users/reset_password/',
        method: 'post',
        data
    })
}

// 重置密码确认
export function resetPasswordConfirm(data) {
    return request({
        url: '/auth/users/reset_password_confirm/',
        method: 'post',
        data
    })
}

// 获取用户信息
export function getUserInfo() {
    return request({
        url: '/auth/users/me/',
        method: 'get',
        requiresAuth: true // 指定需要认证
    })
}

export function changePassword(data) {
    return request({
        url: '/auth/users/set_password/',
        method: 'post',
        requiresAuth: true, // 指定需要认证
        data,
    })
}